/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.fjtu.se1603.lh.dao.Impl;

import edu.fjtu.se1603.lh.dao.PetstoreDao;
import edu.fjtu.se1603.lh.entity.Petstore;
import edu.fjtu.se1603.lh.util.DBUtil;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Administrator
 */
public class PetstoreImpl implements PetstoreDao{



    @Override
    public int add2(Petstore owner) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public Petstore getById2(int id) {
     Petstore store=null;
        try {
            Connection con=DBUtil.getConnection();
            ResultSet rs = con.createStatement().executeQuery("select*from petstore where STORE_ID="+id);
            if(rs.next()){
           store=new Petstore();
           store.setId(rs.getInt(1));
           store.setName(rs.getString(2));
           store.setPwd(rs.getString(3));
           store.setBalance(rs.getString(4));
                    
        System.out.println("我的名字叫："+store.getName());
            }
            
        } catch (SQLException ex) {
            Logger.getLogger(PetstoreImpl.class.getName()).log(Level.SEVERE, null, ex);
        } 
        return store;
    }

    @Override
    public List<Petstore> getList2() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public List<Petstore> getList2(int page, int rowcount) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    
}
